package com.maomao.maomaochong_i.personalPackage;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.maomao.maomaochong_i.MainActivity;
import com.maomao.maomaochong_i.R;
import com.maomao.maomaochong_i.application.MyApplication;
import com.maomao.maomaochong_i.dataBean.MySharePreference;

/**
 * Created by maomao on 2017/5/17.
 */

public class ChangeUser extends AppCompatActivity {
    public  final static int bbb=1;
    private EditText setUserName;
    private Context chaContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.changeuser);
        MyApplication.getInstance().addActivity(this);
        chaContext = getApplicationContext();
        Button a1 =(Button)findViewById(R.id.a1);
        setUserName = (EditText)findViewById(R.id.e1);
        a1.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                String string = setUserName.getText().toString();

                if ("".equals(string)){
                    Toast.makeText(chaContext,"用户名输入错误",Toast.LENGTH_SHORT).show();
                    return;
                }else {
                    Toast.makeText(chaContext,"昵称设置成功",Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent(ChangeUser.this, PensonalMessage.class);
                    intent.putExtra("name",string);
                    startActivity(intent);
                    finish();
                }
            }
        });
    }
}

